<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
	<h:panelGrid columns="3">
		<h:form id="appMenu">
			<p:menubar model="#{organizeMenuManagedBean.model}" id="appMenuBar">

			</p:menubar>
		</h:form>
		<h:form>
			<p:menubar id="searchMenu">
				<f:facet name="options">
					<p:watermark value="Search for Products" for="searchPojo"></p:watermark>
					<h:outputLabel value="Search :" />
					<p:autoComplete value="#{searchManagedBean.selectedItem}"
						minQueryLength="3" queryDelay="300" id="searchPojo"
						emptyMessage="No Results Found"
						completeMethod="#{searchManagedBean.search}" scrollHeight="300"
						var="item" itemLabel="#{item.name}" itemValue="#{item}"
						converter="item" forceSelection="true">
						<p:column
							style="border-left:none;border-right:none;border-top:none;">
							<p:graphicImage value="#{item.itemImagePath}" width="40"
								height="50" />
						</p:column>
						<p:column
							style="border-left:none;border-right:none;border-top:none;">
							<h:outputText value="#{item.brand} " />
							<h:outputText value="#{item.name}" />
						</p:column>
						<p:column
							style="border-left:none;border-right:none;border-top:none;">
							<h:outputText value="#{item.size}" />
						</p:column>
						<p:column
							style="border-left:none;border-right:none;border-top:none;">
							<h:graphicImage value="/images/rupee_symbol.png"></h:graphicImage>
							<h:outputText value="#{item.srp}" />
							<h:outputText value="#{item.price}"
								rendered="#{item.offer ne 0.00 }"
								style="text-decoration: line-through;" />
						</p:column>
						<p:column
							style="border-left:none;border-right:none;border-top:none;">

							<h:commandButton title="Add to Cart"
								action="#{searchManagedBean.addToCart}" value="Add">
								<f:ajax event="click" listener="#{searchManagedBean.addToCart}"
									render=":cartForm" />

								<f:param name="item" value="#{item.itemId}"></f:param>
								<f:setPropertyActionListener value="#{item}"
									target="#{searchManagedBean.selectedItem}" />
							</h:commandButton>
						</p:column>
					</p:autoComplete>
				</f:facet>
			</p:menubar>

		</h:form>
		<ui:include src="../ui/cart.xhtml"></ui:include>
	</h:panelGrid>
</ui:composition>